package com.qf.mpswaggershiro.user.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mpswaggershiro.user.entity.UserAddr;
import com.qf.mpswaggershiro.user.service.IUserAddrService;
import com.qf.mpswaggershiro.vo.Vo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户地址  前端控制器
 * </p>
 *
 * @author cui
 * @since 2023-02-16
 */
@RestController
@RequestMapping("/useraddr")
@CrossOrigin
public class UserAddrController {
    @Autowired
    IUserAddrService userAddrService;

@GetMapping("/list")
    public Vo useraddr(Integer userId){
    //根据userid查询useraddr的所有数据
    List<UserAddr> data = userAddrService.list(new QueryWrapper<UserAddr>().eq("user_id", userId));
    return Vo.ok(data);

}

}
